<div class="white_box">
<div class="box-body">
<span class="hide WallHashID"><?php echo $wallpaper->wallpaper_hash; ?></span>
<?php $width = 540;
$height = 270; ?>
<div class="row">
<div class="col-sm-6">
    <div class="wallpaper_image">
        <img class="thumbnail img-responsive"
             style="width:100%; height:auto; display:block; max-width:<?php echo $width; ?>px;max-height: <?php echo $height; ?>px;"
             src="<?php echo $this->image_workshop->crop_image(ORIGINALS_FOLDER_WF . '/' . $wallpaper->wallpaper_image_path, $width, $height, $wallpaper->wallpaper_crop_position, 'thumbnail'); ?>"
             alt="<?php echo $wallpaper->wallpaper_name; ?>">

        <div class="votes">
                        <span data-loading_msg="正在赞壁纸"
                              data-guest_msg="需要登陆踩才可以使用点赞功能"
                              data-toggle="tooltip" data-placement="bottom" data-original-title="顶"
                              class="voteup btn btn-success btn-xs"><i class="fa fa-thumbs-up"></i> <span
                                class="text"><?php echo $wallpaper->vote_up; ?></span></span>
                        <span data-loading_msg="正在踩壁纸"
                              data-guest_msg="需要登陆踩才可以使用点赞功能"
                              data-toggle="tooltip" data-placement="bottom" data-original-title="踩"
                              class="votedown btn btn-danger btn-xs"><i
                                class="fa fa-thumbs-down"></i> <span
                                class="text"><?php echo $wallpaper->vote_down; ?></span></span>
        </div>
        <div data-guest_msg="需要登陆踩才可以使用收藏功能"
             data-loading_msg_add="正在收藏此壁纸"
             data-loading_msg_remove="正在取消收藏"
             data-added="<?php echo($favourite ? 1 : 0) ?>"
             class="favorites toggle_favorite">
            <?php if ($favourite) { ?>
                <i class="fa fa-heart"></i>
            <?php } else { ?>
                <i class="fa fa-heart-o"></i>
            <?php } ?>
        </div>
    </div>
    

   
</div>
<div class="col-sm-6">
    <div class="wallpaper_title wblock">
        <h2>
            <?php echo $wallpaper->wallpaper_name; ?>
            <?php if ($this->user->get_id() == $wallpaper->user_seq_id) { ?>
                <a href="<?php echo $this->route_links->build_link('upload_wallpaper_edit', array('{hash}' => $wallpaper->wallpaper_hash)) ?>">
                    <small><i class="fa fa-edit"></i> 编辑</small>
                </a>
            <?php } ?>
            <?php if ($this->user->is_admin()) { ?>
                <span class="text-right">
                            <a href="<?php echo base_url($this->config->item('admin_folder') . '/manageWallpapers/edit/' . $wallpaper->wallpaper_seq_id); ?>">
                                <small><i class="fa fa-pencil"></i> 管理
                                </small>
                            </a>
                    </span>
            <?php } ?>
        </h2>
    </div>
    <div class="wallpaper_category">
        <span class="details_title">分类</span> : <a
            href="<?php echo $this->route_links->build_link('category_page', array('{C_SLUG_FULL}' => $wallpaper->cFullSlug)); ?>"><?php echo $wallpaper->category_name; ?></a>
    </div>
    <div class="row row-sm">
        <div class="col-xs-6 col-sm-12">
            <div class="wallpaper_added wblock">
                <span class="details_title">分享者</span>
                : <?php echo $wallpaper->user_name; ?>
            </div>
            <?php if (!$wallpaper->wallpaper_author) $wallpaper->wallpaper_author_site; ?>
            <?php if ($wallpaper->wallpaper_author) { ?>
                <div class="wallpaper_author wblock">
                    <span class="details_title">来源</span> :
                    <a href="<?php echo $wallpaper->wallpaper_author_site; ?>"><?php echo ellipsize($wallpaper->wallpaper_author, 30, .7); ?></a>
                </div>
            <?php } ?>
            <?php if ($colors) { ?>
                <div class="wallpaper_colors">
                    <?php foreach ($colors as $i => $color_data) { ?>
                        <?php if ($i >= 16) break; ?>
                        <a href="<?php echo $this->route_links->build_link('search_page') . '?color=' . $color_data->hex_code; ?>">
                            <span data-toggle="tooltip" data-placement="bottom"
                                  data-original-title="<?php echo round($color_data->count * 100, 2); ?>%"
                                  title="<?php echo round($color_data->count * 100, 2); ?>%"
                                  style="background: #<?php echo $color_data->hex_code; ?>" class="color_block"></span>
                        </a>
                    <?php } ?>
                </div>
            <?php } ?>
            <div class="wallpaper_stats">
                <div><span class="details_title"><i class="fa fa-download"></i> <span
                            class="hidden-xs">下载</span>
                    : <?php echo($wallpaper->total_downloads ? $wallpaper->total_downloads : 0); ?></div>
                <div><span class="details_title"><i class="fa fa-eye"></i> <span
                            class="hidden-xs">浏览</span>
                    : <?php echo($wallpaper->total_views ? $wallpaper->total_views : 1); ?></div>
                <div><span class="details_title"><i class="fa fa-heart"></i> <span
                            class="hidden-xs">收藏</span>
                    : <span
                        id="total_favourite_count"><?php echo($wallpaper->total_favourites ? $wallpaper->total_favourites : 0); ?></span>
                </div>
            </div>

            <div class="wallpaper_rating_single hidden-xs">
                <?php $rating_stars = 5; ?>
                <?php echo rating_block($wallpaper->vote_up, $wallpaper->vote_down, $rating_stars); ?>
                <?php $average_rating = rating_block($wallpaper->vote_up, $wallpaper->vote_down, $rating_stars, true); ?>
                <?php if ($average_rating) { ?>
                    <span class="vote_details">评分
                        : <?php echo round($average_rating, 2); ?>分
                        <em>总分:<?php echo $rating_stars; ?></em>分</span>
                <?php } ?>
            </div>
            <?php if ($wallpaper->tags) { ?>
                <div class="wallpaper_tags wblock">
                    <span class="details_title">标签</span>
                    :<?php $tags = explode(',', $wallpaper->tags) ?>
                    <?php if (!empty($tags)) { ?>
                        <?php foreach ($tags as $i => $tag) { ?>
                            <?php if ($i > 0) echo ', '; ?>
                            <?php $tag = trim($tag); ?>
							
                            <a href="<?php echo base_url(); ?>search?q=<?php echo $tag; ?>"><?php echo $tag; ?></a>
                        <?php } ?>
                    <?php } ?>
                </div>
            <?php } ?>
        </div>
        <div class="col-xs-6 col-sm-12">
            <div data-width="<?php echo $wallpaper->wallpaper_width; ?>"
                 data-height="<?php echo $wallpaper->wallpaper_height; ?>" class="row row-sm dl_links">
                <div class="col-xs-12 col-sm-6">
                    <div class="gen_view_link">
                        <a class="btn btn-success btn-sm btn-block m_t_10 search_available_res hide"
                           href="<?php echo $this->route_links->build_link('wallpaper_preview', $search_replace); ?>"><i
                                class="fa fa-eye"></i> <span
                                class="hidden-xs">预览</span>
                            <span class="screen_width"></span>x<span class="screen_height"></span></a>
                    </div>
                </div>
                <div class="col-xs-12 col-sm-6">
                    <div class="gen_download_link">
                        <a data-msg="Starting Download"
                           class="btn btn-primary btn-sm btn-block m_t_10 search_available_res starting_download hide"
                           href="<?php echo $this->route_links->build_link('wallpaper_preview_download', $search_replace); ?>"><i
                                class="fa fa-download"></i> <span
                                class="hidden-xs">下载</span>
                            <span class="screen_width"></span>x<span class="screen_height"></span></a>
                    </div>
                </div>
            </div>
            <div class="dl_links_error m_t_10 hide">
                <div class="alert alert-danger">
                    对不起，此墙纸不适用于您的屏幕分辨率
                </div>
            </div>
			<?php if ($previous_next) { ?>
        <div class="next_prev">
            <?php if (isset($previous_next['previous'])) { ?>
                <div class="pull-left">
                    <?php $link_build = array('{C_SLUG_FULL}' => $previous_next['previous']->cFullSlug, '{C_SLUG}' => $previous_next['previous']->category_slug, '{W_SLUG}' => $previous_next['previous']->wallpaper_slug, '{W_HASH}' => $previous_next['previous']->wallpaper_hash) ?>
                    <a data-toggle="tooltip" data-placement="bottom"
                       title="上一张: <?php echo $previous_next['previous']->wallpaper_name; ?>"
                       href="<?php echo $this->route_links->build_link('wallpaper_page', $link_build); ?>"><i
                            class="fa fa-backward"></i></a>
                </div>
            <?php } ?>
            <?php if (isset($previous_next['next'])) { ?>
                <div class="pull-right">
                    <?php $link_build = array('{C_SLUG_FULL}' => $previous_next['next']->cFullSlug, '{C_SLUG}' => $previous_next['next']->category_slug, '{W_SLUG}' => $previous_next['next']->wallpaper_slug, '{W_HASH}' => $previous_next['next']->wallpaper_hash) ?>
                    <a data-toggle="tooltip" data-placement="bottom"
                       title="下一张: <?php echo $previous_next['next']->wallpaper_name; ?>"
                       href="<?php echo $this->route_links->build_link('wallpaper_page', $link_build); ?>"><i
                            class="fa fa-forward"></i></a>
                </div>
            <?php } ?>
            <div class="loading hide">
                <i class="fa fa-refresh fa-spin"></i>
            </div>
        </div>
    <?php } ?>
    <div class="clearfix"></div>


        </div>
       
    </div>
	
</div>
</div>
<?php if ($wallpaper->wallpaper_description) { ?>
    <?php echo $wallpaper->wallpaper_description; ?>
<?php } ?>
	<?php echo $this->language->get_ad(5); ?>


<?php if ($resolutions) { ?>
    <div class="resblocks">
        <div><i class="fa fa-desktop"></i> <b>壁纸尺寸</b>
            :
            <small>你的分辨率是 <span class="screen_width"></span> x <span
                    class="screen_height"></span></small>
        </div>
        <hr class="hr-sm"/>
        <table class="table no-border">
            <?php $i = 0; ?>
            <?php foreach ($resolutions as $type => $group) { ?>
                <tr class="res_g_<?php echo $i; ?>">
                    <td class="res_info" style="min-width: 120px">
                        <div><?php echo $type ?>:</div>
                    </td>
                    <td>
                        <ul class="list-inline">
                            <?php $found = false; ?>
                            <?php foreach ($group as $res) { ?>
                                <?php if ($res->resolution_width > $wallpaper->wallpaper_width || $res->resolution_height > $wallpaper->wallpaper_height) continue;
                                $found = true; ?>
                                <?php $template = 'wallpaper_preview_download';
                                if ($this->config->item('display_wallpaper_view_page')) $template = 'wallpaper_preview'; ?>
                                <li class="res_<?php echo $res->resolution_width . 'x' . $res->resolution_height ?>">
                                    <i class="fa fa-caret-right"></i> <a
                                        href="<?php echo $this->route_links->build_link($template, $search_replace + array('{R_WIDTH}' => $res->resolution_width, '{R_HEIGHT}' => $res->resolution_height)); ?>"><?php echo $res->resolution_name; ?></a>
                                </li>
                            <?php } ?>
                        </ul>
                        <?php if (!$found) { ?>
                            <div data-target=".res_g_<?php echo $i; ?>" class="not_found_res"></div>
                        <?php } ?>
                    </td>
                </tr>
                <?php $i++; ?>
            <?php } ?>
        </table>
    </div>
<?php } ?>
</div>
</div>

<?php if ($related_wallpapers) { ?>
    <div class="page-header">
        <h4>猜你喜欢</h4>
    </div>
    <?php echo ws_load_content('contents/items', array('show_remaining_items' => false, 'wallpapers' => $related_wallpapers), false); ?>
<?php } ?>



        <?php if (validation_errors()) { ?>
            <div class="alert alert-warning">
                <?php echo validation_errors(); ?>
            </div>
        <?php } ?>

        <div class="comment_form hidden-xs">
            <?php echo ws_load_content('contents/wallpaper_comment_form.php', array(), true); ?>
        </div>

        <div class="comment_data m_t_10 hidden-xs">
            <?php echo ws_load_content('contents/comments_list.php', array('comments' => $comments), false); ?>
        </div>
        <?php if ($comments) { ?>
            <div id="report_modal" class="modal">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal"
                                    aria-hidden="true">&times;</button>
                            <h4 class="modal-title">举报此评论
                                #<span id="comment_id_selected"></span>
                            </h4>
                        </div>
                        <div class="modal-body">
                            <div class="">
                                <textarea name="your_msg" id="your_msg" class="form-control" cols="30"
                                          rows="5"></textarea>
                                <input type="hidden" class="comment_id_val" name="comment_id" value=""/>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default btn-sm"
                                    data-dismiss="modal">关闭</button>
                            <button data-ajax-url="<?php echo base_url('js/report_comment'); ?>" type="button"
                                    class="report_this btn btn-primary btn-sm">举报
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        <?php } ?>
        <?php if ($comment_count > $this->config->item('comment_limit')) { ?>
            <button data-link="<?php echo base_url('js/load_more_comment/' . $wallpaper->wallpaper_hash) ?>"
                    data-offset="<?php echo $this->config->item('comment_limit'); ?>"
                    class="btn btn-block btn-default load_more_comments text-center"
                    type="button">更多评论
            </button>
        <?php } ?>



    
</div>

